package com.caigp.cookbook2.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.caigp.cookbook2.fragment.MenuFragment;
import com.caigp.cookbook2.fragment.MoreFragment;
import com.caigp.cookbook2.fragment.SearchFragment;

public class MainFragmentPagerAdapter extends FragmentPagerAdapter {

    private Fragment[] fragments = {new SearchFragment(), new MenuFragment(), new MoreFragment()};

    public MainFragmentPagerAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments[position];
    }

    @Override
    public int getCount() {
        return fragments.length;
    }
}
